<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8"/>
	<meta name="baidu-site-verification" content="JdMif0g2tL" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title>angular</title>
</head>
<body ng-app="myApp">
<style type="text/css" media="screen">
	*{
		margin: 0;
		padding: 0;
	}
	span{
		color: red;
		font-size:14px; 
	}
</style>

<div ng-controller="mainCtrl">
	{{news}}
</div>

<div ng-controller="other">
	{{title}}
</div>

<script type="text/javascript">
	document.getElementsByTagName('html')[0].style.fontSize=window.screen.width/10+'px';
</script>
<script src="../js/angular.min.js" charset="utf-8"></script>
<script type="text/javascript">
	var app =angular.module('myApp', []);
	app.factory('mainData', function(){
		return{
			news:'factory'
		}
	});
	//通过service服务
	app.service('otherData',function(){
		//在service中通过this将数据暴露出来
		this.title='service'
	});
	app.controller('mainCtrl', function($scope,mainData){
		$scope.news=mainData.news;
	})
	.controller('other', function($scope,otherData){
		$scope.title=otherData.title;
	})
	
</script>
</body>
</html>
<!--应该是14.11，时间-2017-05-08->